package com.hiv.mapper;

import com.hiv.mapper.domain.SamplingRecordResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 采样数据结果Mapper接口
 *
 * @author zhanghong
 * @date 2023-03-24
 */
@Mapper
@Repository
public interface SamplingRecordResultMapper {
    SamplingRecordResult selectById(Long id);
    List<SamplingRecordResult> selectList(SamplingRecordResult samplingRecordResult);
    int insert(SamplingRecordResult samplingRecordResult);
    int batchInsert(List<SamplingRecordResult> samplingRecordResultList);
    int update(SamplingRecordResult samplingRecordResult);
    int deleteById(Long id);
    int deleteByIds(String[] ids);

    @Select("select * from sampling_record_result where sampling_id=#{samplingId}")
    List<SamplingRecordResult> listBySamplingId(Long samplingId);

    @Select("select count(1) from sampling_record_result where sampling_id=#{samplingId} and (disease_result is not null or disease_num is not null)")
    Integer countDiseaseResult(Long samplingId);
}
